package org.example.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Component(value = "person")
public class Person
{
    @Value("1")
    private Integer id;
    @Value("张三")
    private String name;
    // 方式1
    @Value(value = "#{car}")
    // 方式2 (根据类型注入)
    @Autowired
    private Car car;
}
